gtk_paint_box (widget->style,
widget->window,
priv->upper_arrow_state,
- GTK_SHADOW_OUT,
+ GTK_SHADOW_OUT,
&event->area, widget, "menu",
border_x,
border_y,
gtk_paint_box (widget->style,
widget->window,
priv->lower_arrow_state,
- GTK_SHADOW_OUT,
+ GTK_SHADOW_OUT,
&event->area, widget, "menu",
border_x,
height - border_y - scroll_arrow_height,
if (definitely_within_item (menu_item, event->x, event->y))
menu_shell->activate_time = 0;
-
+
need_enter = (menu->navigation_region != NULL || menu_shell->ignore_enter);
/* Check to see if we are within an active submenu's navigation region
if (priv->upper_arrow_state != GTK_STATE_INSENSITIVE)
{
+ gboolean arrow_pressed = FALSE;
+ GtkStateType arrow_state = GTK_STATE_NORMAL;
+
if (menu->upper_arrow_visible && !menu->tearoff_active)
{
if (touchscreen_mode)
{
- if (enter && menu->upper_arrow_prelight &&
- menu->timeout_id == 0)
+ if (enter && menu->upper_arrow_prelight)
{
- /* Deselect the active item so that
- * any submenus are popped down
- */
- gtk_menu_shell_deselect (menu_shell);
-
- gtk_menu_remove_scroll_timeout (menu);
- menu->scroll_step = -MENU_SCROLL_STEP2; /* always fast */
-
- if (!motion)
+ if (menu->timeout_id == 0)
{
- /* Only do stuff on click. */
- gtk_menu_start_scrolling (menu);
- priv->upper_arrow_state = GTK_STATE_ACTIVE;
+ /* Deselect the active item so that
+ * any submenus are popped down
+ */
+ gtk_menu_shell_deselect (menu_shell);
+
+ gtk_menu_remove_scroll_timeout (menu);
+ menu->scroll_step = -MENU_SCROLL_STEP2; /* always fast */
+
+ if (!motion)
+ {
+ /* Only do stuff on click. */
+ gtk_menu_start_scrolling (menu);
+ arrow_pressed = TRUE;
+ }
+ }
+ else
+ {
+ arrow_pressed = TRUE;
}
-
- gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
- &rect, FALSE);
}
else if (!enter)
{
- gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
- &rect, FALSE);
-
gtk_menu_stop_scrolling (menu);
}
}
{
menu->upper_arrow_prelight = TRUE;
menu->scroll_fast = scroll_fast;
- gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
- &rect, FALSE);
/* Deselect the active item so that
* any submenus are popped down
}
else if (!enter && !in_arrow && menu->upper_arrow_prelight)
{
- gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
- &rect, FALSE);
-
gtk_menu_stop_scrolling (menu);
}
}
}
- priv->upper_arrow_state = menu->upper_arrow_prelight ?
- GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
+ if (arrow_pressed)
+ arrow_state = GTK_STATE_ACTIVE;
+ else if (menu->upper_arrow_prelight)
+ arrow_state = GTK_STATE_PRELIGHT;
+
+ if (arrow_state != priv->upper_arrow_state)
+ {
+ priv->upper_arrow_state = arrow_state;
+
+ gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
+ &rect, FALSE);
+ }
}
/* lower arrow handling */
if (priv->lower_arrow_state != GTK_STATE_INSENSITIVE)
{
+ gboolean arrow_pressed = FALSE;
+ GtkStateType arrow_state = GTK_STATE_NORMAL;
+
if (menu->lower_arrow_visible && !menu->tearoff_active)
{
if (touchscreen_mode)
{
- if (enter && menu->lower_arrow_prelight &&
- menu->timeout_id == 0)
+ if (enter && menu->lower_arrow_prelight)
{
- /* Deselect the active item so that
- * any submenus are popped down
- */
- gtk_menu_shell_deselect (menu_shell);
-
- gtk_menu_remove_scroll_timeout (menu);
- menu->scroll_step = MENU_SCROLL_STEP2; /* always fast */
-
- if (!motion)
+ if (menu->timeout_id == 0)
{
- /* Only do stuff on click. */
- gtk_menu_start_scrolling (menu);
- priv->lower_arrow_state = GTK_STATE_ACTIVE;
+ /* Deselect the active item so that
+ * any submenus are popped down
+ */
+ gtk_menu_shell_deselect (menu_shell);
+
+ gtk_menu_remove_scroll_timeout (menu);
+ menu->scroll_step = MENU_SCROLL_STEP2; /* always fast */
+
+ if (!motion)
+ {
+ /* Only do stuff on click. */
+ gtk_menu_start_scrolling (menu);
+ arrow_pressed = TRUE;
+ }
+ }
+ else
+ {
+ arrow_pressed = TRUE;
}
-
- gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
- &rect, FALSE);
}
else if (!enter)
{
- gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
- &rect, FALSE);
-
gtk_menu_stop_scrolling (menu);
}
}
{
menu->lower_arrow_prelight = TRUE;
menu->scroll_fast = scroll_fast;
- gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
- &rect, FALSE);
/* Deselect the active item so that
* any submenus are popped down
}
else if (!enter && !in_arrow && menu->lower_arrow_prelight)
{
- gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
- &rect, FALSE);
-
gtk_menu_stop_scrolling (menu);
}
}
}
- priv->lower_arrow_state = menu->lower_arrow_prelight ?
- GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
+ if (arrow_pressed)
+ arrow_state = GTK_STATE_ACTIVE;
+ else if (menu->lower_arrow_prelight)
+ arrow_state = GTK_STATE_PRELIGHT;
+
+ if (arrow_state != priv->lower_arrow_state)
+ {
+ priv->lower_arrow_state = arrow_state;
+
+ gdk_window_invalidate_rect (GTK_WIDGET (menu)->window,
+ &rect, FALSE);
+ }
}
}
if (offset <= 0)
priv->upper_arrow_state = GTK_STATE_INSENSITIVE;
- else
+ else if (priv->upper_arrow_state == GTK_STATE_INSENSITIVE)
priv->upper_arrow_state = menu->upper_arrow_prelight ?
GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
if (offset >= menu_height - view_height)
priv->lower_arrow_state = GTK_STATE_INSENSITIVE;
- else
+ else if (priv->lower_arrow_state == GTK_STATE_INSENSITIVE)
priv->lower_arrow_state = menu->lower_arrow_prelight ?
GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;